<?php 
session_start();
include '../../../dbconfig.php';
//$albumName = iconv("UTF-8","windows-874",$_POST['album_name']) ;
//$albumDes = iconv("UTF-8","windows-874",$_POST['album_description']) ;
$albumName = $_POST['album_name'] ;
$albumDes = $_POST['album_description'] ;
$albumPhotographer = $_POST['album_photographer'] ;
$inserted_master_id = $_SESSION['uid'];
$inserted_datetime = date("YmdHis");
$modified_mid = $_SESSION['uid'];
$modified_datetime = date("YmdHis");
if(isset($albumName,$albumDes)){
	$sql = "INSERT INTO album(album_id,album_name,album_description,album_photographer,inserted_master_id,inserted_date_time,modified_master_id,modified_date_time)
		VALUES (null,'$albumName', '$albumDes', '$albumPhotographer', '$inserted_master_id', '$inserted_datetime', '$modified_mid','$modified_datetime')";
	if(mysql_query($sql)){
		$sql = "SELECT MAX(album_id) AS album_id FROM album";
		$sql= 	mysql_query($sql);
		$row = mysql_fetch_array($sql);
		$_SESSION['folder'] = $row['album_id']."_".iconv("UTF-8","windows-874",$albumName);
		mkdir("../../../images/uploads/".$row['album_id']."_".iconv("UTF-8","windows-874",$albumName),0777);
		chmod("../../../images/uploads/".$row['album_id']."_".iconv("UTF-8","windows-874",$albumName), 0777);
		header("Location: ../../dialog/dia_images_upload.php");
	}
}
?>